#include "headfiles.h"
#include <gtest/gtest.h>

using namespace std;

class HashTableTest : public ::testing::Test {
protected:
    virtual void SetUp() {
    }

    virtual void TearDown() {
    }

    HashTable<int> hash_table;
};

TEST_F(HashTableTest, insert) {
    hash_table.insert("abc", 1);
    int val;
    bool ret_code;
    ret_code = hash_table.getVal("abc", val);
    EXPECT_EQ(1, val);
    hash_table.insert("abc", 2);
    ret_code = hash_table.getVal("abc", val);
    EXPECT_EQ(2, val);
}

TEST_F(HashTableTest, remove) {
    hash_table.insert("abc", 1);
    int val;
    bool ret_code;
    ret_code = hash_table.getVal("abc", val);
    EXPECT_EQ(true, ret_code);
    EXPECT_EQ(1, val);

    ret_code = hash_table.remove("abc");
    EXPECT_EQ(true, ret_code);

    ret_code = hash_table.getVal("abc", val);
    EXPECT_EQ(false, ret_code);
}
